package cn.zlj.pethome.org.enu;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.Arrays;

@Getter
@AllArgsConstructor
public enum ShopStateEnu {
    WAIT_AUDIT(0,"待审核"),
    HAVE_AUDIT(1,"已审核"),
    PEJECT(-1,"驳回"),
    PASS(2,"已激活");


    private int code;
    private String name;

    public static String getNameByCode(Integer code){
        ShopStateEnu stateEum = Arrays.stream(ShopStateEnu.values()).filter(state -> state.getCode() == code)
                .findAny( ).orElse( null);
        return null == stateEum?"" :stateEum.getName();
    }
}
